//
//  SWTextView.swift
//  SinaWeibo
//
//  Created by wszyxc on 16/7/26.
//  Copyright © 2016年 wszyxc. All rights reserved.
//

import UIKit

class SWTextView: UITextView {

    
   override var font:UIFont?{
  
        didSet{

            placeHolder.font = font
            
        }
        
    }
    

    override init(frame: CGRect, textContainer: NSTextContainer?) {
        super.init(frame: frame, textContainer: textContainer)
        
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    private func setupUI(){
        
        //添加label
        
        addSubview(placeHolder)
        
        placeHolder.numberOfLines = 0

        //设置约束
        
        placeHolder.snp_makeConstraints { (make) -> Void in
            
            make.leading.equalTo(self).offset(5)
            make.top.equalTo(self).offset(8)
     
        }
        
        
    }
    
    //懒加载label
    
    lazy var placeHolder:UILabel = UILabel(textColor: UIColor.grayColor(), fontSize: 15, preferredMaxLayoutWidth: ScreenWidth - 10)
  
}
